<template>
	<view>
		<!-- 顶部搜索区 -->
		<view
			style="background-color: #00c297;padding: 70rpx 50rpx 20rpx 50rpx;color: #fff;line-height: 80rpx;font-size: 40rpx;">
			<view style="display: flex;justify-content: flex-start;">
				<u-icon name="level" size="30" color="#fff"></u-icon> 公司回收
			</view>
			<view  @click="toSearchpage"
				style="color: #000000; display: flex;justify-content: center;padding: 10rpx;margin: 20rpx 0;background-color: #fff;border-radius: 10rpx;">
				<image style="width: 50rpx;height: 50rpx;margin-right: 20rpx;" src="../../static/image/sousuo.png"
					mode="aspectFill"></image>
				<input :disabled="true" type="text" value="" style="width: 100%;" placeholder="搜索" />
			</view>
		</view>
		<view v-for="item in list"
			style="box-shadow: 0 0 6rpx #00fcbd;padding: 20rpx;background-color: #ffffff;width: 80%;margin: 20rpx auto 10rpx auto;border-radius: 20rpx;">
			{{item.name}}
			<view style="display: flex;justify-content: flex-start;border-top: #d6d6d6 1rpx solid;padding-top: 30rpx;">
				<image :src="item.picture" style="width: 200rpx;height: 200rpx;" mode="aspectFill">
				</image>
				<view style="font-size: 20rpx;line-height: 70rpx;margin-left: 30rpx;">
					<text style="display: block;width: 400rpx;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">{{item.address}}</text>
					<text>营业时间：{{item.businesshours}}</text><br />
					<text>联系电话：{{item.contactnumber}}</text>
				</view>
			</view>
			<view style="width: 100%;text-align: end;">
				<button @click="toCompanyDetails(item.id)" type="primary" size="mini"
					style="background-color: #15dfb2;margin-top: 30rpx;border: none;">立即下单</button>
			</view>
		</view>
		<view style="text-align: center;margin: 30rpx 0;">到底了....</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[]
			}
		},
		onLoad() {
			this.getCompanyInfo()
		},
		methods: {
			getCompanyInfo(){
				this.$api.companyFind().then(res=>{
					this.list=res.data
				})
			},
			// 前往搜索页
			toSearchpage(){
				uni.navigateTo({
					url:"../search/search"
				})
			},
			toCompanyDetails(id){
				uni.navigateTo({
					url:"./companyDetails?id="+id
				})
			}
		}
	}
</script>

<style>
	page {
		background-color: #eff2f4;
	}
</style>
